package org.amuthu.expression.terminal;

import org.amuthu.expression.AbstractExpression;
import org.amuthu.expression.exception.TypeMismatchException;

/**
 * Abstract base class for all expressions requiring no arguments.
 */
abstract public class TerminalExpression extends AbstractExpression
{


    /**
     * Create a new terminal expression.
     */
    public TerminalExpression()
    {
        // nothing to do
    }

    /**
     * Return the number of children required in a terminal expression.
     * This will always evaluate to <code>0</code>.
     *
     * @return  <code>0</code>
     */
    @Override
    public int getChildCount()
    {
        return 0;
    }

    // A terminal expression cannot have a type mismatch
    @Override
    public int checkType() throws TypeMismatchException
    {
        return getType();
    }
}
